package org.pisces.wechat.enums;

import java.util.List;

import org.apache.commons.lang3.EnumUtils;

public enum  EMsgType implements EnumIdentifiable<String>{
	TEXT("text","文本消息"),  
    IMAGE("image","图片消息"),  
    MUSIC("music","音乐消息"),
    VIDEO("video","视频消息"),  
    VOICE("voice","语音消息"),  
    LOCATION("location","地理位置消息"),  
    LINK("link","链接消息"),
    EVENT("event","事件推送"),
    NEWS("news","图文消息"),
	TRANSFER_CUSTOMER_SERVICE("transfer_customer_service","转发客服消息");
	
    private String value;
    
    private String desc;
  
    EMsgType(String value,String desc) {  
        this.value = value;  
        this.desc= desc;
    }  
    
    public String getDesc(){
    	return desc;
    }
    
    public String getValue(){
    	return value;
    }
    
	public static List<EMsgType> ALL = EnumUtils.getEnumList(EMsgType.class);
	
	public static EMsgType getMsgType(String typeVal) {
		for (EMsgType type : ALL) {
			if(type.value.equals(typeVal)) {
				return type;
			}
		}
		return null;
	}

	@Override
	public String getIdentifiable() {
		return this.getValue();
	}
    
}
